﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MessageList.aspx.cs" Inherits="School.SystemManage.WebPages.MessageBoard.MessageList" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link href="../../css/right.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .dtdcb{width:5%;}
        .dtd1{width:5%; }
        .dtd2{width:10%;}
        .dtd3{width:35%; text-align:left; }
        .dtd4{width:30%; text-align:left; background-color:#FFFFCC;}
        .dtd5{width:8%;}
        .dtd6{width:7%;}
        
        .dth3{ text-align:center; width:35%;}
        .dth4{ text-align:center; width:30%;}
        #dl_message{ width:100%;}
        #dl_message td{ border-collapse:collapse;}
        .dataTableList{ width:100%;}
        .dataTableList td,.dataTableList th{border:solid 1px #A8C7CE; border-collapse:collapse; }
        .pager_container1{ width:100%; background-color:#D3EAEF; border:solid 1px #A9CBEE;}
        #AspNetPager1{ float:right; border:solid 1px #A8C7CE;  height:25px; line-height:25px; margin-right:30px;}
        .rbtlChecked td{ border:none;}
    </style>
    <script type="text/javascript">
        function CheckAll(checkBoxAll, isInTable) {
            var dataTable = document.getElementById("dl_message");
            var checkBoxes = dataTable.getElementsByTagName("INPUT");
            var startIndex = 0;
            if (isInTable) {
                startIndex = 1;
            }
            for (var i = startIndex; i < checkBoxes.length; i++) {
                checkBoxes[i].checked = checkBoxAll.checked;
            }
        }

        function HasCheckedRow() {
            var dataTable = document.getElementById("dl_message");
            var checkBoxes = dataTable.getElementsByTagName("INPUT");
            for (var i = 1; i < checkBoxes.length; i++) {
                if (checkBoxes[i].checked)
                    return confirm("确定要删除吗？");
            }
            alert("选择要删除的项");
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="title_bg">
            <div class="floatLeft title_text_div">留言管理 > 留言列表</div> 
            <ul class="floatRight">
                <li><input id="chk_Total" type="checkbox" class="floatLeft" onclick="CheckAll(this,false);" /><span class="checkAll floatLeft" onclick="CheckAll(this,false)">全选</span><div class="clear"></div></li>
                <li class="delete"><asp:LinkButton ID="lbtnDelete" runat="server" 
                        OnClientClick="return HasCheckedRow();" onclick="lbtnDelete_Click">删除</asp:LinkButton></li>
            </ul>
            <div class="clear"></div>
        </div>
        <div>
            <asp:DataList ID="dl_message" runat="server" CellSpacing="0" DataKeyField="MsgID" 
                oncancelcommand="dl_message_CancelCommand" 
                oneditcommand="dl_message_EditCommand" 
                onupdatecommand="dl_message_UpdateCommand" 
                onitemdatabound="dl_message_ItemDataBound">
                <HeaderTemplate>
                    <table class="dataTableList" cellspacing="0">
                        <tr>
                            <th class="dtdcb"><input id="chk_All" type="checkbox" onclick="CheckAll(this,true);" /></th>
                            <th class="dtd1">留言者</th>
                            <th class="dtd2">留言时间</th>
                            <th class="dth3">留言内容</th>
                            <th class="dth4">回复内容</th>
                            <th class="dtd5">是否通过</th>
                            <th class="dtd6">操作</th>
                        </tr> 
                    </table>                   
                </HeaderTemplate>
                <ItemTemplate>
                    <table class="dataTableList" cellspacing="0">
                        <tr>
                            <td class="dtdcb"><asp:CheckBox ID="cbChecked" runat="server" /></td>
                            <td class="dtd1"><%#Eval("ClientName") %></td>
                            <td class="dtd2"><%#Eval("QTime") %></td>
                            <td class="dtd3"><%#Eval("Question") %></td>
                            <td class="dtd4"><%#Eval("Answer") %></td>
                            <td class="dtd5"><%#(bool)Eval("IsChecked") == true ? "通过" : "未通过"%></td>
                            <td class="dtd6">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">编辑</asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <EditItemTemplate>
                    <table class="dataTableList" cellspacing="0">
                        <tr >
                            <td class="dtdcb"></td>
                            <td class="dtd1"><%#Eval("ClientName") %></td>
                            <td class="dtd2"><%#Eval("QTime")%></td>
                            <td class="dtd3"><%#Eval("Question")%></td>
                            <td class="dtd4" valign="top">
                                <asp:TextBox ID="txbAnswer" runat="server" Text='<%#Eval("Answer") %>' TextMode="MultiLine" Width="99%" Height="50"></asp:TextBox>
                            </td>
                            <td class="dtd5">
                                <asp:RadioButtonList ID="rbtlChecked" runat="server" RepeatDirection="Horizontal" BorderStyle="None" CssClass="rbtlChecked">
                                    <asp:ListItem Value="1">是</asp:ListItem>
                                    <asp:ListItem Value="0">否</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                            <td class="dtd6">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Update">确定</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Cancel">取消</asp:LinkButton>
                            </td>
                        </tr>
                    </table>                
                </EditItemTemplate>
            </asp:DataList>
        </div>
        <div class="pager_container1" id="a" runat="server">
            <webdiyer:AspNetPager runat="server" ID="AspNetPager1" PageSize="10"                
                CustomInfoHTML="每页%PageSize%条，%CurrentPageIndex%/%PageCount%页" 
                FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" 
                ShowCustomInfoSection="Left" SubmitButtonText="Go" TextAfterPageIndexBox="页"  
                CustomInfoClass="customInfo" CustomInfoSectionWidth="120"
                TextBeforePageIndexBox="转到" onpagechanged="AspNetPager1_PageChanged">
            </webdiyer:AspNetPager>
            <div class="clear"></div>
        </div>
        <div class="red">
            <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label></div> 
    </div>
    </form>
</body>
</html>
